package com.igeek.boot_4_druid.mapper;

import com.igeek.boot_4_druid.entity.Orders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: zhiyu
 * @Date:19:37
 * @DESC:
 */
@Mapper
public interface UserAndOrderMapper {
    @Select("select user.name from user left join orders on user.id = orders.user_id where orders.id = #{id}")
    public String selectUsername(@Param(value = "id") int id);
    @Select("select * from orders where user_id = #{id}")
    public List<Orders> selectOrdersByUserId(@Param(value = "id") int id);
}
